﻿using XLZF.MicroServices.IRepository;
using XLZF.MicroServices.IServices;
using XLZF.MicroServices.Models;
using XLZF.MicroServices.Repository;

namespace XLZF.MicroServices.Services;

public class ClothingDictService : IClothingDictService
{
    private static ModelMigration.XLZFContext context = new ModelMigration.XLZFContext();

    private IRepository<Clothing_Brand> _repository = new Repository<Clothing_Brand>(context);

    /// <summary>
    /// 添加
    /// </summary>
    /// <param name="clothing_Brand"></param>
    /// <returns></returns>
    public int AddClothingBrand(Clothing_Brand clothing_Brand)
    {
        return _repository.Add(clothing_Brand);
    }

    /// <summary>
    /// 删除
    /// </summary>
    /// <param name="clothing_Brand"></param>
    /// <returns></returns>
    public int DelClothingBrand(Clothing_Brand clothing_Brand)
    {
        return _repository.Remove(clothing_Brand);
    }

    /// <summary>
    /// 改
    /// </summary>
    /// <param name="clothing_Brand"></param>
    /// <returns></returns>
    public int EditClothingBrand(Clothing_Brand clothing_Brand)
    {
        return _repository.Update(clothing_Brand);
    }

    /// <summary>
    /// 查
    /// </summary>
    /// <returns></returns>
    public List<Clothing_Brand> GetClothingBrand()
    {
        return _repository.GetAll().ToList();
    }
}
